//
// Created by gxy on 2025/8/31.
//

#include <common.h>

int findMid(vector<int> &s1,vector<int>& s2) {
    int cnt=(s1.size()+s2.size())/2;
    int m=-1,n=-1;
    while (cnt>0) {
        if (s1[m+1]<s2[n+1]) {
            m++;
            cnt--;
            if (cnt==0) {
                return s1[m];
            }
        }else {
            n++;
            cnt--;
            if (cnt==0) {
                return s2[n];
            }
        }
    }
    return -1;
}

int main() {
    vector<int> s1{11,13,15,17,19},s2{2,4,6,8,20};

    int res= findMid(s1,s2);
    cout<<res<<endl;
    return 0;
}